@extends('layout.main')

@section('content')
    <div class="col-sm-8 blog-main">
        <div>
            <p>搜索"{{$query}}"出现的文章, 共有 {{$posts->total()}} 条结果</p>
        </div>        <div style="height: 20px;">
        </div>
        <div>
            @foreach($posts as $post)
                <div class="blog-post">
                    <h2 class="blog-post-title"><a href="/posts/{{$post->id}}" >{{$post->title}}</a></h2>
                    <p class="blog-post-meta">{{$post->created_at->toFormattedDateString()}} by <a href="/user/{{$post->user_id}}">{{$post->user->name}}</a></p>

                    {{str_limit($post->content, 100, '...')}}
                    <p class="blog-post-meta">赞 {{$post->zans_count}}  | 评论 {{$post->comments_count}}</p>
                </div>
            @endforeach

            {{--<div class="blog-post">--}}
            {{--<h2 class="blog-post-title"><a href="/posts/62" >你的眼，住着天的蓝</a></h2>--}}
            {{--<p class="blog-post-meta">May 14, 2017 by <a href="/user/5">轩脉刃</a></p>--}}

            {{--<p>文／青衫落墨</p><p>我一手遮住落日旁的霞光﻿</p><p>一手息伞、驻足不敢上前﻿</p><p>羞赧、挂在暮色边缘...--}}
            {{--<p class="blog-post-meta">赞 3  | 评论 2</p>--}}
            {{--</div>--}}

            <ul class="pagination">
                {{$posts->links()}}
            </ul>

        </div><!-- /.blog-main -->
    </div>
@endsection